package com.springboot.listener;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

/**
 * @author wtcode
 * @Description
 * @date 2025/1/4 - 16:51
 */
//@Component
public class MyRunListener implements SpringApplicationRunListener {


    public MyRunListener(SpringApplication application, String[] args){

    }

    public void starting() {
        System.out.println("starting...项目启动中");
    }


    public void environmentPrepared(ConfigurableEnvironment environment) {
        System.out.println("environmentPrepared...环境对象开始准备");
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("contextPrepared...上下文对象开始准备");

    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("contextLoaded...上下文对象开始加载");

    }

    @Override
    public void started(ConfigurableApplicationContext context) {
        System.out.println("started...加载完成");
    }

    @Override
    public void running(ConfigurableApplicationContext context) {
        System.out.println("running...运行");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        System.out.println("failed...启动失败");
    }
}
